<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>
<spring:message  code="pim"/> - <spring:message  code="homepage.project"/>&nbsp;
<c:out value="${bean.project.name}"></c:out> - <spring:message  code="title.project.list.task"/>	
</title>	
<link href="<%= request.getContextPath() %>/css/custom.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/v.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/jquery.ui.dialog.css" rel="stylesheet" />	
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.6.2.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-ui-1.8.14.custom.js"></script>
<%@include file="script/sort-table.jsp" %>
<%@include file="script/pim-util.jsp" %>
<%@include file="script/paging-script.jsp" %>
<%@include file="script/task-script.jsp" %>
<script type="text/javascript">
var TSort_Data = new Array ('mytable','', 's','s','s', 's', 's','s','s','s');
tsRegister();
</script>
</head>
<body>
<c:if test="${bean.isSigned == true}">
<div id="all">
    <div id="wrapper">
		<div id="mainheader">
			<jsp:include page="include/common/headerSignedIn.jsp" />
		</div> 
		<div id="content-wrapper">
			<div id="top-menu">
			    <jsp:include page="include/common/topMenuHome.jsp" />
			</div>
			<div class="workspace-menu-top">
			   <c:choose>
				    <c:when test="${bean.isAdmin == true}">
				      <jsp:include page="include/common/admin-menu.jsp" />
				    </c:when>
				    <c:otherwise>
				      <jsp:include page="include/common/user-menu.jsp" />
				    </c:otherwise>
			   </c:choose>
			</div> 
			
			<div class="tabs-content v-row">
			  <form method="post" name="frmTasks">
				<div class="v-row" style="padding-top: 10px;padding-bottom: 20px;">
					<div class="v-row-left" style="margin-left: 10px;">
						<span class="v-title">
						    <spring:message  code="title.type.task" /> 
						</span>
						<select style="width:200px;margin-left:10px;margin-right:10px;height:24px;" name="type">	
						    <option value="all"><spring:message  code="all"/></option>
				            <c:forEach items="${bean.taskTypes}" var="type">
								<c:choose>
									<c:when test="${type.key == bean.type}">
				                        <option value="${type.key}" selected="selected"><spring:message  code="${type.value}"/></option>
									</c:when>
									<c:otherwise>
										<option value="${type.key}"><spring:message  code="${type.value}"/></option>
									</c:otherwise>
								</c:choose>
							</c:forEach>
					    </select>	    
					</div>	
				</div> 
				<div class="v-row">
				<table id="mytable" class="width100 v-table" cellspacing="1">
				    <thead> 
					  <tr class="v-table-header">
					      <td width="10%">#</td>
					      <td width="15%"><spring:message  code="title.task.category" /></td>
					      <td width="15%"><spring:message  code="title.task.status" /></td>
					      <td width="30%"><spring:message code="title.task.summary" /></td>
					      <td width="10%"><spring:message  code="task.reporter" /></td>
						  <td width="10%"><spring:message  code="task.assignedto" /></td>	     	     
					      <td width="10%"><spring:message  code="title.task.priority" /></td>	     
				      </tr>  
				    </thead> 
					<tbody>
				      <c:choose>
						<c:when test="${bean.tasksCount == 0}">
						<tr>
							<td colspan="8" class="v-warning-message">
								<spring:message code="search.empty" />
							</td>
						</tr>
						</c:when>
				      <c:otherwise>
					  <c:forEach items="${bean.tasks}" var="task" varStatus="count">
					    <tr bgcolor="${task.taskStatus.color}">
					    <td scope="row">
					       <div style="text-align: center;">
							    <a href="taskDetail.htm?pnum=${bean.project.number}&tcode=${task.code}">${task.code}</a>
							    <br/>
							    <a style="padding-right: 5px;" href="updateTask.htm?pnum=${bean.project.number}&tcode=${task.code}">
							     <img alt='<spring:message code="project.update.task"/>' 
							          title='<spring:message code="project.update.task"/>'  
							          src="<%=request.getContextPath()%>/images/editIcon.gif">
							    </a>			
						   </div>	
						</td>
						<td class="v-text-cell" scope="row"><c:out value="${task.taskCategory.name}" /></td>
						<td class="v-text-cell" scope="row"><c:out value="${task.taskStatus.name}" /></td>
						<td class="v-text-cell" scope="row"><a href="taskDetail.htm?pnum=${bean.project.number}&tcode=${task.code}" style="text-decoration: none;"><c:out value="${task.summary}" /></a></td>
						<td class="v-text-cell" scope="row"><c:out value="${task.reporter}" /></td>
						<td class="v-text-cell" scope="row"><c:out value="${task.assignedto}" /></td>				
						<td class="v-text-cell" scope="row"><c:out value="${task.taskPriority.name}" /></td>								
				        </tr>
					  </c:forEach>
					  </c:otherwise>
					  </c:choose>						  				
					</tbody>
				</table>
				</div>
				<c:if test="${bean.total > bean.itemsPerPage}">
					<div id="paging" class="v-row" style="margin-bottom: 20px;">
						<c:set value="${bean.paging}" var="paging"></c:set>
						<%@ include file="include/common/pagination.jsp"%>
					</div>		
				</c:if>
				<input type="hidden" name="tab" value="${bean.tab}"/>
				<input type="hidden" name="type" value="${bean.type}"/>
				<input type="hidden" name="pnum" value="${bean.project.number}"/>				
				</form>
			</div>
		</div>
		<div class="menu-task-color v-row">
		    <jsp:include page="include/task/menu-task-color.jsp" />
		</div>
		<div class="footer">
			<jsp:include page="include/common/footer.jsp" />
		</div>
	</div>
</div>
</c:if>
</body>
</html>